<template>
  <div class="content">
    <div class="header">关于我们的100件恋爱小事</div>
    <div class="main">
      <el-row :gutter="10">
        <el-col
          v-for="item in workList"
          :key="item.id"
          :xs="8"
          :sm="6"
          :md="4"
          :lg="3"
          :xl="1"
        >
          <div class="workCard">
            <div class="cardTitle">
              <i class="iconfont" :class="item.iconfont"></i>
              {{ item.title }}
            </div>
            <div class="cardTime">
              <i class="iconfont icon-time"></i>
              {{ item.workTime }}
            </div>
            <div class="cardMessage">{{ item.message }}</div>
          </div>
        </el-col>
      </el-row>
    </div>
  </div>
</template>
<script>
export default {
  name: "mywork",
  props: {
    msg: String,
  },
  data() {
    return {
      url: "",
      workList: [],
    };
  },
  async created() {
    let resData = await this.axios.get("./data/data.json");
    if (resData.status !== 200) {
      this.$message.error("请求错误");
      return;
    }
    this.url = resData.data.mywork_json;
 
    this.axios.get(this.url).then((response) => {
      if (response.status !== 200) {
        this.$message.error("请求错误");
        return;
      }
      this.workList = response.data.workList;
    });
  },
};
</script>

<style lang="less" scoped>
.content {
  width: 100%;
  // height: 100vh;
  // overflow: hidden;
  background: #ecc6bcb2;
  .header {
    padding-top: 50px;
    padding-bottom: 10px;
    font-size: 25px;
    font-family: "LHZT";
  }
  .main {
    padding: 10px;
    overflow-y: scroll;
    .workCard {
      min-height: 100px;
      background: #f1b8acbe;
      margin-bottom: 10px;
      display: flex;
      flex-direction: column;
      justify-content: start;
      align-items: flex-start;
      border-radius: 10px;
      padding: 5px;
      .cardTitle {
        font-size: 14px;
        font-family: "LHZT";
        text-align: start;
      }
      .cardTime {
        font-size: 12px;
        font-family: "LHZT";
        padding: 5px 0;
        color: rgba(55, 189, 230, 0.699);
      }
      .iconfont {
        font-size: 14px;
      }
      .cardMessage {
        color: #ee6e4e;
        font-size: 12px;
        text-align: start;
        font-family: "LHZT";
      }
    }
  }
}

.el-col {
  border-radius: 4px;
}
</style>
